package cn.demoncat.util.lang.entity.tree;

import java.util.List;
import java.util.Objects;

/**
 * Ztree节点
 * 
 * @author yxl
 *
 */
public final class ZtreeNode {
 
	/**
	 * 节点id
	 */
	private String id;

	/**
	 * 节点名称
	 */
	private String name;

	/**
	 * 是否为父节点
	 */
	private boolean isParent;

	/**
	 * 是否选中
	 */
	private boolean checked;
	
	/**
	 * 节点图标
	 */
	private String icon;
	
	/**
	 * 子节点数据
	 */
	private List<ZtreeNode> children;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public boolean getIsParent() {
		return isParent;
	}

	public void setIsParent(boolean isParent) {
		this.isParent = isParent;
	}

	public boolean isChecked() {
		return checked;
	}

	public void setChecked(boolean checked) {
		this.checked = checked;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public List<ZtreeNode> getChildren() {
		return children;
	}

	public void setChildren(List<ZtreeNode> children) {
		this.children = children;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		ZtreeNode ztreeNode = (ZtreeNode) o;
		return isParent == ztreeNode.isParent &&
				checked == ztreeNode.checked &&
				Objects.equals(id, ztreeNode.id) &&
				Objects.equals(name, ztreeNode.name) &&
				Objects.equals(icon, ztreeNode.icon) &&
				Objects.equals(children, ztreeNode.children);
	}

	@Override
	public int hashCode() {
		return Objects.hash(id, name, isParent, checked, icon, children);
	}

	@Override
	public String toString() {
		return "ZtreeNode [id=" + id + ", name=" + name + ", isParent=" + isParent + ", checked=" + checked + ", icon="
				+ icon + ", children=" + children + "]";
	}
	
	 
}
